import axios from "axios"
axios.defaults.baseURL = 'https://netease-cloud-music-api-beige-alpha.vercel.app'
// 设置axios拦截
// axios.interceptors.request.use(config => {
//   config.headers.Authorization = window.sessionStorage.getItem('token')
//   // console.log(config)
//   return config
// })

// 获取轮播图列表
export function getBannerList(type=2){
  return axios.get(`/banner?type=${type}`)
}
// 获取推荐歌单
export function getMusicList(limit=30){
  return axios.get(`/personalized?limit=${limit}`)
}
// 获取歌单详情
export function getMusicListDetail(id){
  return axios.get(`/playlist/detail?id=${id}`)
}
// 获取歌词
export function getLyric(id){
  return axios.get(`/lyric?id=${id}`)
}
// 获取搜索结果
export function getSearchValue(value){
  return axios.get(`/search?keywords=${value}`)
}
// 登录
export function setlogin(phone,password){
  return axios.get(`/login/cellphone?phone=${phone}&password=${password}`)
}
// 获取用户详情
export function getUserMes(id){
  return axios.get(`/user/detail?uid=${id}`)
}
export default {
  getBannerList,getMusicList,getMusicListDetail,getLyric,getSearchValue,setlogin
}